Webhook Support for New World Records#52
Merged
NicholasBottone merged 8 commits intomainfrom Jun 26, 2025
Merged
Conversation
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull Request Overview
Adds Discord webhook notifications and an admin test interface for world record events.
- Prevents horizontal overflow in the base template and enforces navbar wrapping rules.
- Introduces an
admin_requireddecorator, awebhook_testview, URL routing, and a test page for Discord webhooks. - Implements
send_world_record_webhookandtest_world_record_webhookinhighscores/lib.pyand hooks intoapprove_score.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| home/templates/home/base.html | Added CSS to prevent horizontal overflow and force navbar nowrap. |
| highscores/views.py | Added admin_required decorator and webhook_test admin view. |
| highscores/urls.py | Registered the webhook_test/ endpoint. |
| highscores/templates/highscores/webhook_test.html | Created admin UI for sending test webhooks. |
| highscores/lib.py | Added webhook-sending functions and integrated them into score approval. |
Comments suppressed due to low confidence (2)
highscores/lib.py:120
- The
loggingmodule is used here but not imported; addimport loggingat the top to avoid aNameError.
logging.error(f"Discord webhook failed with status: {response.status}")
highscores/urls.py:14
- [nitpick] Indentation is inconsistent with other routes in
urlpatterns; align this line with the others for readability.
path('webhook-test/', views.webhook_test, name='webhook-test'),
|
|
||
|
|
||
| def admin_required(view_func): | ||
| """Custom decorator to require admin access (staff or superuser)""" |
There was a problem hiding this comment.
Use functools.wraps on the wrapper to preserve the original view function's metadata (name, docstring, etc.).
Suggested change
| """Custom decorator to require admin access (staff or superuser)""" | |
| """Custom decorator to require admin access (staff or superuser)""" | |
| @functools.wraps(view_func) |
…mport what you need
Member
Author
|
@NicholasBottone probably good to merge if you think is good, need to put the webhook url in prod env vars. I did notice the test is failing now for the home page, but I don't really understand why. The text it's looking for is still the same. |
NicholasBottone
approved these changes
Jun 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support to send notifications when a world record is set to a discord web hook.